home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / Include / sun4.md / timerTick.h < prev    next >
C/C++ Source or Header  |  1990-12-08  |  3KB  |  114 lines

  1. /*
  2.  * timerTick.h --
  3.  *
  4.  *      Declarations for the Sun3 machine dependent clock timer.
  5.  *
  6.  * Copyright 1985, 1988 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  *
  15.  * rcsid: $Header: /sprite/src/kernel/timer/sun3.md/RCS/timerTick.h,v 9.1 90/09/06 18:17:45 jhh Exp $ SPRITE (Berkeley) 
  16.  */
  17.  
  18. #ifndef _TIMERTICK
  19. #define _TIMERTICK
  20.  
  21. #include "spriteTime.h"
  22.  
  23. /* DATA STRUCTURES: */
  24.  
  25.  
  26. /*
  27.  * On the Sun-3, Timer_Ticks is just a Time value because the free-running
  28.  * counter keeps track of time.
  29.  */
  30. typedef Time Timer_Ticks;
  31.  
  32.  
  33. /*
  34.  * Definitions for useful intervals and clock values. 
  35.  * See timer.h for more details.
  36.  */
  37.  
  38.  extern unsigned int     timer_IntZeroSeconds; 
  39.  extern unsigned int     timer_IntOneMillisecond;   
  40.  extern unsigned int     timer_IntOneSecond;
  41.  extern unsigned int     timer_IntOneMinute;
  42.  extern unsigned int     timer_IntOneHour; 
  43.  extern Timer_Ticks    timer_TicksZeroSeconds;
  44.  extern Time         timer_MaxIntervalTime; 
  45.  
  46.  
  47.  
  48. /*
  49.  * Because the Sun3's timer speaks in the same units as type Time, we can
  50.  * use the Time_ modules routines to Add and Subtract
  51.  */
  52.  
  53. #ifdef lint
  54. #define Timer_AddTicks(a,b,c)      Time_Add((* ((Time *) &a)),\
  55.                         (* ((Time *) &b)), \
  56.                         (Time *) c)
  57. #define Timer_SubtractTicks(a,b,c) Time_Subtract((* ((Time *) &a)), \
  58.                          (* ((Time *) &b)), \
  59.                          (Time *) c)
  60. #else /* lint */
  61. #define Timer_AddTicks(a,b,c)      Time_Add(a,b,c)
  62. #define Timer_SubtractTicks(a,b,c) Time_Subtract(a,b,c)
  63. #endif /* lint */
  64.  
  65. /*
  66.  * Conversion to Ticks to Time and Time to Ticks is fast too.
  67.  */
  68.  
  69. #define Timer_TicksToTime(a,b)        *(b) = a;
  70. #define Timer_TimeToTicks(a,b)        *(b) = a;
  71.  
  72.  
  73. extern void Timer_AddIntervalToTicks _ARGS_((Timer_Ticks absolute, unsigned int interval, Timer_Ticks *resultPtr));
  74. extern void Timer_GetCurrentTicks();
  75.  
  76.  
  77. /*
  78.  *----------------------------------------------------------------------
  79.  *
  80.  * Tick Comparisons --
  81.  *
  82.  *    Timer_TickLT:    tick1  <   tick2
  83.  *    Timer_TickLE:    tick1  <=  tick2
  84.  *    Timer_TickEQ:    tick1  ==  tick2
  85.  *    Timer_TickGE:    tick1  >=  tick2
  86.  *    Timer_TickGT:    tick1  >   tick2
  87.  *
  88.  * Results:
  89.  *     TRUE    - the relation holds for the 2 values.
  90.  *     FALSE    - the relation does not hold.
  91.  *
  92.  * Side effects:
  93.  *     None.
  94.  *
  95.  *----------------------------------------------------------------------
  96.  */
  97.  
  98. #ifdef lint
  99. #define Timer_TickLT(a,b)    Time_LT((* ((Time *) &a)), (* ((Time *) &b)))
  100. #define Timer_TickLE(a,b)    Time_LE((* ((Time *) &a)), (* ((Time *) &b)))
  101. #define Timer_TickEQ(a,b)    Time_EQ((* ((Time *) &a)), (* ((Time *) &b)))
  102. #define Timer_TickGE(a,b)    Time_GE((* ((Time *) &a)), (* ((Time *) &b)))
  103. #define Timer_TickGT(a,b)    Time_GT((* ((Time *) &a)), (* ((Time *) &b)))
  104. #else /* lint */
  105. #define Timer_TickLT(a,b)    Time_LT(a,b)
  106. #define Timer_TickLE(a,b)    Time_LE(a,b)
  107. #define Timer_TickEQ(a,b)    Time_EQ(a,b)
  108. #define Timer_TickGE(a,b)    Time_GE(a,b)
  109. #define Timer_TickGT(a,b)    Time_GT(a,b)
  110. #endif /* lint */
  111.  
  112. #endif /* _TIMERTICK */
  113.  
  114.